export const useDialog = () => {
	const getDialogTitle = (prefix: string, name?: string) => {
		if (name) {
			return `${prefix} - ${name}`;
		} else {
			return prefix;
		}
	};

	//历史数据
	const dataChartDialog = reactive<any>({
		title: getDialogTitle(`历史数据趋势`),
		dataValue: null,
		dataKey: "",
		visible: false
	});
	//历史图片
	const imgDialog = reactive<any>({
		title: getDialogTitle(`历史图片`),
		dataKey: "",
		visible: false
	});
	//文件
	const fileDialog = reactive<any>({
		title: getDialogTitle(`文件列表`),
		detail: {},
		dataKey: "",
		visible: false
	});
	const locationDialog = reactive({
		visible: false,
		dataKey: "",
		detail: {
			location: { lat: null, lng: null, address: null }
		},
		title: getDialogTitle("位置与轨迹")
	});
	const configAlarmDialog = reactive({
		visible: false,
		title: getDialogTitle("告警配置")
	});
	const videoDialog = reactive({
		videoUrl: "",
		visible: false,
		title: getDialogTitle("实时视频")
	});

	const gatewayDialog = reactive<any>({
		title: "网关信息",
		detail: {},
		visible: false
	});
	const productDialog = reactive<any>({
		title: "产品信息",
		detail: {},
		visible: false
	});
	const deviceDialog = reactive<any>({
		title: "添加设备",
		detail: {},
		visible: false
	});
	return {
		getDialogTitle,
		dataChartDialog,
		imgDialog,
		fileDialog,
		locationDialog,
		configAlarmDialog,
		videoDialog,
		gatewayDialog,
		productDialog,
		deviceDialog
	};
};
